import request from '@/utils/request.js'

// 获取商品列表
export const goodsListService = (params) => {
    return request.get('/goods/findAll', { params })
}
//删除商品
export const deleteGoodsService = (id) => {
    return request.delete('/goods/delete?id=' + id)
}
//添加商品
export const createGoodsService = (data) => {
    return request.post('/goods/create', data)
}
//更新商品
export const updateGoodsService = (data) => {
    return request.post('/goods/update', data)
}

//分页查询
export const GoodsListService = (params)=>{
    return request.get('/goods/selectPage',{params})
}
//根据标题查询
export const selectByNameService = (name)=>{
    return request.get('/goods/findByName?name='+name)
}
//批量删除
export const batchDeleteGoodsService = (ids)=>{
    return request.delete('/goods/delete/batch',{data:ids})
}

//根据id获取商品信息
export const getGoodsByIdService = (id)=>{
    return request.get('/goods/findById?id='+id)
}

//添加购物车
export const addCartService = (data)=>{
    return request.post('/cart/create',data)
}